package com.gmail.rusal4ica.dots;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

/**
 * @author The Imperial Sword Team
 */

public class ChooseBoardSizeDialog extends DialogFragment {
	int arrayR;
	
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
    	arrayR = R.array.board_size;
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setTitle(R.string.pick_board_size);
        builder.setItems(arrayR, new DialogInterface.OnClickListener() {
	            public void onClick(DialogInterface dialog, int which) {
	            	switch(which){
	            	case 0: OptionsActivity.sizeN = 7; break;
	            	case 1: OptionsActivity.sizeN = 9; break;
	            	case 2: OptionsActivity.sizeN = 11; break;
	            	default: OptionsActivity.sizeN = 7;
	            	}
	        }
        });

        // Create the AlertDialog object and return it
        return builder.create();
    }
    
    public void onDismiss(DialogInterface dialog){
    	startActivity(MainActivity.intentPlay);
    	this.dismiss();
    }   
    
}